import React from 'react';
import { Switch } from 'react-router'
import { BrowserRouter as Router, Route, } from 'react-router-dom'
import { Provider } from 'react-redux'

import App from '../App';
import Home from '../view/Home';
import Questions from '../view/Questions';
import List from '../view/List';
import Integral from '../view/Integral';
import GoodsList from '../view/GoodsList';
import Exchange from '../view/Exchange';
import LuckyDraw from '../view/LuckyDraw';
import Error404 from '../view/Error404';

const Root = (store) => (
    <Provider store={store}>
        <Router>
            <App>
                <Switch>
                    <Route path="/questions/" exact component={Home} />
                    <Route path="/questions/question" component={Questions} />
                    <Route path="/questions/list" component={List} />
                    <Route path="/questions/integral" component={Integral} />
                    <Route path="/questions/goodsList" component={GoodsList} />
                    <Route path="/questions/exchange" component={Exchange} />
                    <Route path="/questions/luckyDraw" component={LuckyDraw} />
                    <Route component={Error404} />
                </Switch>
            </App>
        </Router>
    </Provider>
)

export default Root
